//
//  BKMyOrderAlert.m
//  bestkeep
//
//  Created by Mr. Wu on 16/12/15.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKMyOrderAlert.h"
#import "AppDelegate.h"

@implementation BKMyOrderAlert
//初始化View以及添加单击蒙层逻辑
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.frame = frame;
        self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
        self.userInteractionEnabled = YES;
    }
    return self;
}
//蒙层添加到Window上
+(instancetype)makeViewWithMask:(CGRect)frame{
    BKMyOrderAlert *mview = [[self alloc]initWithFrame:frame];
    mview.userInteractionEnabled = YES;
    AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    BKMyOrderDetailAlert *alert =[[BKMyOrderDetailAlert alloc]initWithFrame:CGRectMake(0, 0, 270, 176)];
    alert.center = mview.center;
    [delegate.window addSubview:mview];
    [mview addSubview:alert];
    alert.delegate = mview;
    return mview;
}
-(void)cancelButtonClick{
    [self removeFromSuperview];
}
-(void)sureButtonClick:(NSString *)str{
    if ([self.delegate respondsToSelector:@selector(cancelOrderbuttonClick:)]) {
        [self.delegate cancelOrderbuttonClick:str];
    }
    [self removeFromSuperview];
}
@end
